from enum import Enum, unique


@unique
class Color(Enum):
    red = 1
    green = 2
    blue = 3


print(Color.red)
print(Color['red'])
print(Color(1))

# 调取枚举成员中的 value 和 name
print(Color.red.value)
print(Color.red.name)

# 遍历
for color in Color:
    print(color)

for name, member in Color.__members__.items():
    print(name, "->", member)

print(Color.red == Color.green)
print(Color.red.name is Color.green.name)
